//
//  ReversiBoardLineDirection.m
//  Reversi
//
//  Created by 成瀬 龍人 on 2/5/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ReversiBoardLineDirection.h"


@implementation ReversiBoardLineDirection
@synthesize x,y;

- (id)init:(int)aX :(int)aY{
	[super init];
	if ((-1 <= aX && aX <= 1) &&
		(-1 <= aY && aY <= 1) &&
		(aX != 0 || aY != 0)){
		x = aX;
		y = aY;
	}else {
		@throw 	[[ReversiOutOfRangeException alloc] initWithInt:aX:aY];
	}
	return self;
}

- (bool)isEqual:(id)object{
	if ([object isKindOfClass:[self class]]){
		return [object x] == x && [object y] == y;
	}
	return false;
}

- (id)copyWithZone:(NSZone*)zone{
	return [[[self class] alloc] init:x:y];
}

@end
